package com.chengyu.core.enums;


import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;

/**
 * 场景标识枚举类
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0
 */
public enum ScencEnum {
    ELECTRIC_POWER_ECONOMY("电力_节约用电", "electric_power_economy"),
    MEITUAN_CYCLING("美团骑行", "meituan_cycling"),
    HELLOBIKE_CYCLING("哈啰骑行", "hellobike_cycling"),
    TRIP_NEW_ENERGY("新能源车出行", "trip_new_energy"),
    YOUJIA_CUP("自备咖啡杯", "youjia_cup"),
    RIDE_CODE_BUS("碳碳星球", "ride_code_bus"),//乘车码-公交
    RIDE_CODE_METRO("碳碳星球", "ride_code_metro"),//乘车码-地铁
    YOUJIA_SHOPPING_BAG("自备购物袋", "youjia_shopping_bag"),//有家-自备购物袋

    DITIE("蚂蚁森林", "ditie"),//蚂蚁森林-地铁
    GONGJIAO("蚂蚁森林", "gongjiao"),//蚂蚁森林-公交
    LVSEZHENGWU("绿色政务", "lvsezhengwu"),//蚂蚁森林-绿色政务
    GUAHAO("绿色医疗", "guahao"),//蚂蚁森林-预约挂号

    AI_HUI_SHOU("爱回收", "ai_hui_shou"),  //"爱回收"

    MERCHANTS_BANK_BUS("招商银行", "merchants_bank_bus"), //"招商银行公交"

    MERCHANTS_BANK_METRO("招商银行", "merchants_bank_metro"),  //"招商银行地铁"
    STATE_GRID_BROWNOUT("网上国网", "state_grid_brownout"),  //"网上国网"
    HUI_JIE_DIAN_BROWNOUT("惠节电", "hui_jie_dian_brownout"),  //"惠节电"
    ;

    private String name;
    private String value;

    public String getName() {
        return name;
    }

    public String getValue() {
        return value;
    }

    ScencEnum(String name, String value) {
        this.name = name;
        this.value = value;
    }

    public static ScencEnum find(String name) {
        return Arrays.stream(ScencEnum.values()).filter(o -> StringUtils.equalsIgnoreCase(o.name(), name)).findFirst().orElse(null);
    }

    public String value() {
        return this.value;
    }

    public static String findSceneName(String value) {
        for (ScencEnum item : ScencEnum.values()) {
            if (item.name().equalsIgnoreCase(value)) {
                return item.name;
            }
        }
        return null;
    }
}
